
public class CheckingAccount extends Account 
{
	/**
	 * the amount of money on the debit card
	 */
	private double fDebitAmount;
	/**
	 * rate for the debit card
	 */
	private static double debitRate = 4.7;
	/**
	 * default amount for debit card
	 */
	private static double debitAmount = 0;
	/**
	 * creates a basic checking account with no debit card attached.
	 * @param name the checking account owner's name
	 * @param street the checking account owner's street
	 * @param zipCode the checking account owner's town zip code
	 * @param town the checking account owner's town
	 * @param country the checking account owner's country
	 * @param checkingAccountNumber the checking account number tied to this account
	 */
	public CheckingAccount(String name, String street, String zipcode, String town, String country, int checkingAccountNumber)
	{
		fName = name;
		fStreet = street;
		fZipcode = zipcode;
		fTown = town;
		fCountry = country;
		fAccountNumber = checkingAccountNumber;
		fDebitAllowed = false;
		fDebitAmount = debitAmount;
		
	}
	/**
	 * creates a basic checking account with no debit card attached.
	 * @param name the savings account owner's name
	 * @param street the savings account owner's street
	 * @param zipCode the savings account owner's town zip code
	 * @param town the savings account owner's town
	 * @param country the savings account owner's country
	 * @param debit the amount of money on the debit card
	 * @param checkingAccountNumber the checking account number tied to this account
	 */
	public CheckingAccount(String name, String street, String zipCode, String town, String country, float debit, int checkingAccountNumber)
	{
		fName = name;
		fStreet = street;
		fZipcode = zipCode;
		fTown = town;
		fCountry = country;
		fAccountNumber = checkingAccountNumber;
		fDebitAllowed = true;
		fDebitAmount = debit;
	}
	
	/**
	 * determines costs associated with checking account;
	 */
	public void determineCosts()
	{
		fBalance = fBalance - costs;
		if(fBalance < 0)
		{
			fBalance = fBalance - (fBalance * debitRate / 100);
		}
	}
	/**
	 * print statement that prints out information
	 * pertaining to account
	 */
	
	public void print()
	{
		System.out.println("**************************************");
		System.out.println("Checking account:     " + fAccountNumber);
		System.out.println("Account holder name: " + fName);
		System.out.println("Address:             " + fStreet);
		System.out.print("                     " + fZipcode);
		System.out.println(" " + fTown);
		System.out.println(fCountry.toUpperCase());
		System.out.println("**************************************");
		System.out.println("Balance:  " + fBalance);
		System.out.println("**************************************");
	}
	/**
	 * used to withdrawal money as long as balance does not go below zero
	 * @param amount the amount withdrawing
	 * @return true if withdrawal went through false otherwise
	 */
	public boolean withdrawal(double amount)
	{
		if(((fBalance - amount) < 0))
		{
			return false;
		}
		else
		{
			fBalance = fBalance - amount;
			return true;
		}
	}	
	/**
	 * gets current balance of checking account
	 * @return
	 */
	public double getBalance()
	{
		return fBalance;
	}
	/**
	 * used to increase balance in checking account.
	 * @param amount the balanced is increased by.
	 */
	public void increaseBalance(double amount)
	{
		fBalance += amount;
	}
	/**
	 * used to decrease balance in checking account.
	 * @param amount the balanced is decreased by.
	 */
	public void decreaseBalance(double amount)
	{
		fBalance -= amount;
	}
	/**
	 * used to get debit amount.
	 * @param debit amount.
	 */
	public double getDebitAmount()
	{
		return fDebitAmount;
	}
	/**
	 * used to swt balance in checking account.
	 * @param amount the balanced is set to.
	 */
	public void setBalance(double amount)
	{
		fBalance = amount;	
	}
	/**
	 * getter for accountNumber
	 * @return accountNumber
	 */
	public int getAccountNumber() 
	{
		return fAccountNumber;	
	}
	/**
	 * equals method that checks to see if to accounts equal
	 * @return true if account numbers equal false otherwise
	 */
	public boolean equals(CheckingAccount o)
	{
		if(fAccountNumber == o.getAccountNumber())
			return true;
		else
			return false;
				
	}
}
